/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BD;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ARMGARCES
 */
@Entity
@Table(name = "bitacora")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Bitacora.findAll", query = "SELECT b FROM Bitacora b"),
    @NamedQuery(name = "Bitacora.findByIdBitacora", query = "SELECT b FROM Bitacora b WHERE b.idBitacora = :idBitacora"),
    @NamedQuery(name = "Bitacora.findByFecha", query = "SELECT b FROM Bitacora b WHERE b.fecha = :fecha"),
    @NamedQuery(name = "Bitacora.findByIp", query = "SELECT b FROM Bitacora b WHERE b.ip = :ip"),
    @NamedQuery(name = "Bitacora.findByMac", query = "SELECT b FROM Bitacora b WHERE b.mac = :mac")})
public class Bitacora implements Serializable {
    
    @Basic(optional =     false)
    @Column(name = "fecha")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    @Column(name = "mensj")
    private String mensj;
    
    @JoinColumn(name = "fkidAcciones", referencedColumnName = "idAcciones")
    @ManyToOne(optional = false)
    private Acciones fkidAcciones;
    
    @JoinColumn(name = "fkidUsuario", referencedColumnName = "idUsuario")
    @ManyToOne(optional = false)
    private Usuario fkidUsuario;
    
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idBitacora")
    private Integer idBitacora;
    
    @Column(name = "ip")
    private String ip;
    
    @Column(name = "mac")
    private String mac;

    public Bitacora() {
    }

    public Bitacora(Integer idBitacora) {
        this.idBitacora = idBitacora;
    }

    public Bitacora(Integer idBitacora, Date fecha) {
        this.idBitacora = idBitacora;
        this.fecha = fecha;
    }

    public Integer getIdBitacora() {
        return idBitacora;
    }

    public void setIdBitacora(Integer idBitacora) {
        this.idBitacora = idBitacora;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public Usuario getFkidUsuario() {
        return fkidUsuario;
    }

    public void setFkidUsuario(Usuario fkidUsuario) {
        this.fkidUsuario = fkidUsuario;
    }

    public Acciones getFkidAcciones() {
        return fkidAcciones;
    }

    public void setFkidAcciones(Acciones fkidAcciones) {
        this.fkidAcciones = fkidAcciones;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idBitacora != null ? idBitacora.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Bitacora)) {
            return false;
        }
        Bitacora other = (Bitacora) object;
        if ((this.idBitacora == null && other.idBitacora != null) || (this.idBitacora != null && !this.idBitacora.equals(other.idBitacora))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "BD.Bitacora[ idBitacora=" + idBitacora + " ]";
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getMensj() {
        return mensj;
    }

    public void setMensj(String mensj) {
        this.mensj = mensj;
    }
}
